package com.example.backend_422.controller;


import com.example.backend_422.common.Result;
import com.example.backend_422.service.impl.NotifyServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/notify")
@CrossOrigin(origins = "*", maxAge = 3600)
public class NotifyController {

    @Autowired
    private NotifyServiceImpl notifyService;

    @GetMapping("/getAllNotify")
    public Result getAllNotify() {
        return notifyService.getAllNotify();
    }

    @DeleteMapping("deleteById")
    public Result deleteById(@RequestParam("id") Integer id) {
        return notifyService.deleteById(id);
    }

    @PostMapping("/addNotify")
    public Result addNotify(@RequestParam("title") String title,
                            @RequestParam("content") String content) {
        return notifyService.addNotify(title,content);
    }

}
